<?php

namespace common\models\firstpage;

use Yii;
use yii\behaviors\BlameableBehavior;
use yii\db\ActiveQuery;
use yii\db\ActiveRecord;
use yii\behaviors\TimestampBehavior;
use common\helpers\HashidsHelper;
use common\enums\StatusEnum;
use common\models\base\User;
use common\helpers\RegularHelper;
use common\traits\Tree;


/**
 * This is the model class for table "{{%by_requirement}}
 *
 *
 * @package common\models\banner
 * @property int $id 主键
 * @property string $img 图片
 * @property string $title 标题
 *
 */
class Requirement extends ActiveRecord
{

    /**
     * {@inheritdoc}
     */
    public static function tableName()
    {
        return '{{%by_requirement}}';
    }

    /**
     * {@inheritdoc}
     */
    public function rules()
    {
        return [

            [['id', 'img','title'], 'safe'],
            [['status', 'created_at', 'updated_at'], 'integer']

        ];
    }



    /**
     * {@inheritdoc}
     */
    public function attributeLabels()
    {
        return [
            'id' => 'ID',
            'img' => '图片',
            'title' => '标题',
            'status' => '状态',
            'created_at' => '创建时间',
            'updated_at' => '修改时间',
        ];
    }



    public function behaviors()
    {

        return [
            [
                'class' => TimestampBehavior::class,
                'attributes' => [
                    ActiveRecord::EVENT_BEFORE_INSERT => ['created_at', 'updated_at'],
                    ActiveRecord::EVENT_BEFORE_UPDATE => ['updated_at'],
                ],
            ]
        ];
    }
}
